﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    private string strusername;
    private string strpassword;
    private Boolean validlogin;
    private dbConn db;


    protected void Page_Load(object sender, EventArgs e)
    {

        txt_UserName.Focus();

    }
    protected void btn_Submit_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            db = new dbConn ();
            strusername = txt_UserName.Text;
            strpassword = txt_Password.Text;
            strusername = strusername.Trim();

            validlogin = db.CheckLogin(strusername, strpassword);

            if (validlogin)
            {
                Session["ValidUser"] = true;
                Session.Timeout = 40;
                Response.Redirect("Export.aspx");
            }
            else
            {
                Session.Abandon();
                lbl_Result.Text = "Invalid Username or password. Try Again.";

            }

        }
    }
}
